import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '原料名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '库存( kg )',
    align: "center",
    dataIndex: 'stock',
    width: 100
  },
  // {
  //   title: '库存状态',
  //   align: "center",
  //   dataIndex: 'materialStatus',
  //   width: 80
  // },
  {
    title: '物料等级',
    align: "center",
    dataIndex: 'materialGrade_dictText',
    width: 80
  },
  {
    title: '水份量（%）',
    align: "center",
    dataIndex: 'moistureContent',
    width: 110
  },
  {
    title: '含油量（%）',
    align: "center",
    dataIndex: 'oilContent',
    width: 110
  },
  {
    title: '粉末度（%）',
    align: "center",
    dataIndex: 'finesContent',
    width: 110
  },
  {
    title: '供应商',
    align: "center",
    dataIndex: 'supplier'
  },
  {
    title: '产地',
    align: "center",
    dataIndex: 'originPlace',
    slots: { customRender: 'pcaSlot' },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "原料名",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
  // {
  //   label: "库存状态",
  //   field: 'materialStatus',
  //   component: 'Input',
  //   colProps: {span: 6},
  // },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '原料名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入原料名!'},
             ];
    },
  },
  {
    label: '库存( kg )',
    field: 'stock',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入库存( kg )!'},
             ];
    },
  },
  {
    label: '物料等级',
    field: 'materialGrade',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "material_grade"
    },
  },
  {
    label: '水份量（%）',
    field: 'moistureContent',
    component: 'InputNumber',
  },
  {
    label: '含油量（%）',
    field: 'oilContent',
    component: 'InputNumber',
  },
  {
    label: '粉末度（%）',
    field: 'finesContent',
    component: 'InputNumber',
  },
  {
    label: '供应商',
    field: 'supplier',
    component: 'Input',
  },
  {
    label: '产地',
    field: 'originPlace',
    component: 'JAreaLinkage',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
